<!DOCTYPE html>
<html >
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">

    <link rel="stylesheet" href="/sunfc/css/weui.css">
    <link rel="stylesheet" href="/sunfc/css/jquery-weui.css">
    <link rel="stylesheet" href="/sunfc/css/style.css">
    <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.2&key=fc8d203edc94af7f4fe3a3f02fb99a74"></script>

    <style type="text/css">

    </style>
</head>
<body class="back1">
<form method="post" action="">
    <div class="index-top-fix">
        <div class="top">
            <p style="text-align: center;color:#ccc;">{$web_config['sitename']}</p>
        </div>
        <div class="bottom">
            <div class="tab-bottom">
                <a href={:url('sunfc.passenger/index')} >乘客</a>
                <a href="javascript:;" class="cur">车主</a>
                <div class="pao">公益我最行</div>
            </div>
            <div style="position: absolute;right: 10px;top: 0;">
                <a href="tel:{$web_config['kefu_tel']}"><img src="/sunfc/images/kefu.png" width="20" style="margin-right:12px;"></a>
                <a href="{:url('sunfc.users/index')}"><img src="/sunfc/images/user1.png" width="15"></a>
            </div>
        </div>
    </div>

    <!-- 这里写内容 -->
    <div style="margin-top: 88px;">
    </div>
    <!-- 待处理行程 -->
    {if condition="$publish_data neq ''"}
    <div class="index-box index-waitting">
        <div class="weui-cells">
            <div class="weui-cell">
                <div class="weui-cell__hd">
                    <img src="/sunfc/images/daichuli.png" width="20">
                </div>
                <div class="weui-cell__bd">
                    <p>待处理行程</p>
                </div>
            </div>
            <a class="weui-cell weui-cell_access left0" href="{:url('index/sunfc.driver/wait_order',['publish_id'=>$publish_data['id']])}">
                <div class="weui-cell__hd">
                    <img src="/sunfc/images/shal.png" width="40" height="40">
                </div>
                <div class="weui-cell__bd">
                    <p>{$publish_data['depart_time']}</p>
                    <p class="huic">
                        <span>{$publish_data['begin_detail']}</span>
                        <img src="/sunfc/images/jiantou.png" width="15" />
                        <span>{$publish_data['end_detail']}</span>
                    </p>
                </div>
                <div class="weui-cell__ft">等待接单</div>
            </a>
        </div>
    </div>
    {else /}
    {if condition="$trip_data neq ''"}
    <!-- 行程中 -->
    <div class="index-box index-xingchengz">
        <div class="weui-cells">
            <div class="weui-cell">
                <div class="weui-cell__hd">
                    <img src="/sunfc/images/daichuli.png" width="20">
                </div>
                <div class="weui-cell__bd">
                    <p>行程中</p>
                </div>
            </div>
            <div class="weui-cell left0">
                <div class="weui-cell__hd">
                    <div class="touxiang">
                        <img class="t-photo" src="{$trip_data['headimgurl']}" width="60" height="60">
                        {if  condition="($trip_data['sex']) eq 2"}
                        <img class="t-icon" src="/sunfc/images/sex2.png" width="15">
                        {else /}
                        <img class="t-icon" src="/sunfc/images/sex1.png" width="15">
                        {/if}
                    </div>
                </div>
                <div class="weui-cell__bd pos-tel">
                    <p class="f17">{$trip_data['nickname']}</p>
                    <p class="xcz-chexing">
                        <span class="xinren">信任值{$trip_data['trust_rank']}分</span>
                      <!--  <span>{$trip_data['car_info']}</span>-->
                    </p>
                    <div class="pos-tel-abs"><a href="tel:{$trip_data['tel']}"><img src="/sunfc/images/tel.png" width="30"></a></div>
                </div>
            </div>
            <div class="weui-cell left0">

                <div class="weui-cell__bd xingchengz">

                    <div class="weui-cells">
                        <div class="weui-cell">
                            <div class="weui-cell__hd">
                                <img src="/sunfc/images/wait.png" width="8" class="wait">
                            </div>
                            <div class="weui-cell__bd">
                                <p>
                                    <span>{$trip_data['depart_time']}</span>
                                    <span class="font1">{$trip_data['number']}坐</span>
                                </p>
                            </div>
                        </div>
                        <div class="weui-cell">
                            <div class="weui-cell__hd">
                                <span class="dian"></span>
                            </div>
                            <div class="weui-cell__bd">
                                <p>
                                    <span>{$trip_data['begin_place']}</span>
                                    <span class="font1">{$trip_data['begin_detail']}</span>
                                </p>
                            </div>
                        </div>
                        <div class="weui-cell">
                            <div class="weui-cell__hd">
                                <span class="dian2"></span>
                            </div>
                            <div class="weui-cell__bd">
                                <p>
                                    <span>{$trip_data['end_place']}</span>
                                    <span class="font1">{$trip_data['end_detail']}</span>
                                </p>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
            <div class="weui-cell left0">

                <div class="weui-cell__bd">
                    <p class="xingchengz-tel">
                        <span class="col1">请耐心等待</span>
                        <a href="{:url('sunfc.driver/trip',['order_id'=>$trip_data['id']])}" class="telephone" style="padding: 0 16px;">进入行程</a>
                    </p>
                </div>
            </div>
        </div>
    </div>
    {else /}
    <div class="weui-tab index-box index-kuashi">
        <div class="weui-navbar" id="navbarShi">
            <input type="hidden" name="region" id="region" value="0">
            <a class="weui-navbar__item weui-bar__item--on" href="#tab1" onclick="get_region()">
                市内
            </a>
            <a class="weui-navbar__item" href="#tab2"  onclick="get_region()">
                跨城
            </a>
        </div>
        <div class="weui-tab__bd">
            <!--本市-->
            <div id="tab1" class="weui-tab__bd-item weui-tab__bd-item--active">
                <div class="weui-cells">
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <span class="dian"></span>
                        </div>
                        <div class="weui-cell__bd">
                            <p class="f15 open-popup" id="addressStart"style="cursor:pointer">
                                出发地
                            </p>
                        </div>
                    </div>
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <span class="dian2"></span>
                        </div>
                        <div class="weui-cell__bd">
                            <p class="f15 col1" id="addressEnd" style="cursor:pointer">
                                目的地
                            </p>
                        </div>
                    </div>
                </div>
            </div>
            <!--跨市-->
            <div id="tab2" class="weui-tab__bd-item">
                <div class="weui-cells">
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <span class="dian"></span>
                        </div>
                        <div class="weui-cell__bd">
                            <p class="f15 open-popup" id="addressStartKua" style="cursor:pointer">
                                出发地
                            </p>
                        </div>
                    </div>
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <span class="dian2"></span>
                        </div>
                        <div class="weui-cell__bd">
                            <p class="f15 col1" id="addressEndKua" style="cursor:pointer">
                               目的地
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {/if}
    {/if}

    <!-- 发现 -->
    <div class="index-box index-waitting index-find">
        <div class="weui-cells">
            <div class="weui-cell">
                <div class="weui-cell__hd">
                    <img src="/sunfc/images/faxian.png" width="20">
                </div>
                <div class="weui-cell__bd">
                    <p>发现</p>
                </div>
            </div>
            {if  condition="($type['type']) eq 2"}
            <a class="weui-cell weui-cell_access left0" href="javascript:;"  id="share_pop">
                <div class="weui-cell__hd">
                    <img src="/sunfc/images/liwu.png" width="20">
                </div>
                <div class="weui-cell__bd">
                    <p>邀请车主</p>
                </div>
                <div class="weui-cell__ft f13">公益同行<span class="yuan"></span></div>
            </a>
            {else /}
            {/if}
            <!--附近车主-->
            <div id="in_city">
                <a class="weui-cell weui-cell_access left0" href="{:url('car_incity')}">
                    <div class="weui-cell__hd">
                        <img src="/sunfc/images/fujin.png" width="20">
                    </div>
                    <div class="weui-cell__bd">
                        <p>附近乘客</p>
                    </div>
                    <div class="weui-cell__ft f13">{$sum1}人</div>
                </a>
                <div class="NearbyPassengers">
                    {volist name="car_incity" id="vo"}
                    <a href="{:url('sunfc.driver/car_incity',['city'=>$vo['end_detail']])}">{$vo['end_detail']}<span>{$vo['co']}人</span></a>
                    {/volist}
                </div>
            </div>
            <!--跨城车主-->
            <div id="out_city">
                <a class="weui-cell weui-cell_access left0" href="{:url('car_outcity')}">
                    <div class="weui-cell__hd">
                        <img src="/sunfc/images/chengshi.png" width="20">
                    </div>
                    <div class="weui-cell__bd">
                        <p>跨城乘客</p>
                    </div>
                    <div class="weui-cell__ft f13">{$sum2}人</div>
                </a>
                <div class="NearbyPassengers">
                    {volist name="car_outcity" id="vo"}
                    <a href="{:url('sunfc.driver/car_outcity',['city'=>$vo['end_place']])}">{$vo['end_place']} <span>{$vo['co']}人</span></a>
                    {/volist}
                </div>
            </div>
        </div>
    </div>

    <div style="margin: 5px;">
        <img src="/sunfc/images/guanggao.jpg" style="width:100%">
    </div>

    <!--市内-你从哪儿出发-->
    <div id="addressStartAll" class="weui-popup__container popup-address">
        <div class="weui-popup__overlay"></div>
        <div class="weui-popup__modal">
            <div class="popup-address-search">
                <div class="address" id="cityAddress" style="cursor:pointer">
                    <span class="location_bs"></span>
                    <img src="/sunfc/images/xia.png" width="20">
                </div>
                <input type="text" id="addressText1" placeholder="出发地" name="addressText1" onfocus='this.value=""'>
                <a href="javascript:;" class="close-popup" id="aaa1">取消</a>
            </div>
        </div>
    </div>
    <div class="pos-city-box index-box" id="posCityBox" style="display: none;">
        {volist name='city_list' id='vo'}
        <a href="javascirpt:;">{$vo['city_name']}</a>
        {/volist}
    </div>
    <!--市内-你要去哪儿-->
    <div id="addressStartAll2" class="weui-popup__container popup-address">
        <div class="weui-popup__overlay"></div>
        <div class="weui-popup__modal">
            <div class="popup-address-search">
                <div class="address"  id="cityAddress_go">
                    <span id="endplace" class="location_bs"></span>
                    <img src="/sunfc/images/xia.png" width="20">
                </div>
                <input type="text" id="addressText2" placeholder="目的地" name="addressText2" onfocus='this.value=""'>
                <a href="javascript:;" class="close-popup" id="aaa2">取消</a>
            </div>
        </div>
    </div>
    <!--跨市-你从哪儿出发-->
    <div id="addressStartAll3" class="weui-popup__container popup-address">
        <div class="weui-popup__overlay"></div>
        <div class="weui-popup__modal">
            <div class="popup-address-search">
                <div class="address"  id="cityAddress1" style="cursor:pointer">
                    <span class="location_bs"></span>
                    <img src="/sunfc/images/xia.png" width="20">
                </div>
                <input type="text" id="addressText3" placeholder="出发地" name="addressText3" onfocus='this.value=""'>
                <a href="javascript:;" class="close-popup" id="aaa3">取消</a>
            </div>
        </div>
    </div>
    <div class="pos-city-box index-box" id="posCityBox1" style="display: none;">
        {volist name='city_list' id='vo'}
        <a href="javascirpt:;">{$vo['city_name']}</a>
        {/volist}
    </div>
    <!--跨市-你要去哪儿-->
    <div id="addressStartAll4" class="weui-popup__container popup-address">
        <div class="weui-popup__overlay"></div>
        <div class="weui-popup__modal">
            <div class="popup-address-search">
                <div class="address" id="cityAddress2" style="cursor:pointer">
                    <span>请选择</span>
                    <img src="/sunfc/images/xia.png" width="20">
                </div>
                <input type="text" id="addressText4" placeholder="目的地" name="addressText4" onfocus='this.value=""'>
                <a href="javascript:;" class="close-popup" id="aaa4">取消</a>
            </div>
        </div>
    </div>
</form>
<!--分享给好友-->
<div class="share-box" id="share_box">
    <div class="share-pop"></div>
    <div class="share-pop-div">
        <div style="text-align: right;margin-top: 20px;"><img src="/sunfc/images/jiantou3.png" width="200"></div>
        <p class="p1">点击右上角分享给好友<br/>邀请朋友成为车主</p>
    </div>
</div>
<script src="/sunfc/js/jquery.min.js"></script>
<script src="/sunfc/js/jquery-weui.min.js"></script>
<script src="/sunfc/js/store.js"></script>
<style>
    .demos-content-padded{padding:15px}
    .amap-sug-result{width:94%;left: 3%!important;border:0;background:#fff;border-radius: 2px;box-shadow:0px 0px  10px 3px #e7e7e7;top:46px;}
    .auto-item-span{display:block;padding-left:0;font-size: 13px;color:#939393;}
    .auto-item{background: url("/sunfc/images/wait.png") no-repeat left 7% center;background-size: auto 17%;padding-left:12%;font-size: 15px;line-height: 24px;border-bottom: 1px solid #e5e5e5;}
</style>
<script>
    $(function(){
        autoOptions = {
            city: $('.location_bs').text(), 		                 // 城市，默认全国
            input: "addressText1",   // 使用联想输入的input的id
        };
        cityChoice(autoOptions);
    });
    <!--邀请他成为车主-->
    $("#share_pop").on("click",function () {
        $("#share_box").show();
    });
    $("#share_box").on("click",function () {
        $("#share_box").hide();
    });
    //默认显示本市
    $('#in_city').show();
    $('#out_city').hide();

    //拿到值------市内还是跨城
    function get_region() {
        //需要延迟一下，选择值不出错
        setTimeout(function () {
            var aa=$('.weui-bar__item--on')[0].innerText;
            if (aa=="市内"){
                aa=0;
            }else{
                aa=1;
            }
            $('#region').val(aa);
            if($('#region').val()==0){
                $('#in_city').show();
                $('#out_city').hide();
            }else{
                $('#in_city').hide();
                $('#out_city').show();
            }
            console.log( "当前状态:"+$('#region').val());
        }, 5);
    }

    // 本市起点输入框判断,如果没有完成基本认证，则不让他选择地址
    $(document).on("click", "#addressStart", function() {
        if ($('#tel').val()==''){
            $.confirm("您需要完成基础认证才可以发布行程", "温馨提示", function() {
                //确定操作
                location.href = "{:url('sunfc.users/authuser')}";
            }, function() {
                //取消操作
            });
        }else{
            $("#addressStartAll").popup();
        }

    });
    // 本市终点输入框判断,必须先选择起始点后才能输入终点
    $(document).on("click", "#addressEnd", function() {
        if($("#addressStart").attr("vname") == undefined){
            $.toast("请先选择起点", "text");
        }else{
            $("#addressStartAll2").popup();
            autoOptions = {
                city: $('.location_bs').text(), 		        // 本市终点城市和起点城市一致
                input: "addressText2"						// 使用联想输入的input的id
            };

            $('#posCityBox').click(function () {
                $.toast("您的载客区域为本市，不可切换","text");
            })

            cityChoice(autoOptions);
        }
    });
    // 跨市起点输入框判断
    $(document).on("click", "#addressStartKua", function() {
        if ($('#tel').val()==''){
            $.confirm("您需要完成基础认证才可以发布行程", "温馨提示", function() {
                //确定操作
                location.href = "{:url('sunfc.users/authuser')}";
            }, function() {
                //取消操作
            });
        }else{
            $("#addressStartAll3").popup();
            autoOptions = {
                city: $('.location_bs').text(), 		        // 跨市起点城市
                input: "addressText3"						// 使用联想输入的input的id
            };
            cityChoice(autoOptions);
        }

    });
    // 跨市终点输入框判断
    $(document).on("click", "#addressEndKua", function() {
        if($("#addressStartKua").attr("vname") == undefined){
            $.toast("先选择起点", "text");
        }else{
            $("#addressStartAll4").popup();
        }
    });

    // 切换城市的显示
    $(document).on("click", ".address", function() {
        $("#posCityBox").show();
    });
    //城市切换的隐藏
    $(document).on("click", "#aaa1, #aaa2, #aaa3, #aaa4", function() {
        $("#posCityBox").hide();
    });

    var autoOptions;
    //本市起点------城市切换
    $.each($("#posCityBox a"), function (k,v) {
        $(v).click(function () {
            $("#cityAddress span").text($(this).text());
            $("#posCityBox").hide();
            autoOptions = {
                city: $(this).text(), 		 // 城市，默认全国
                input: "addressText1"						// 使用联想输入的input的id
            };
            cityChoice(autoOptions);
        });
    });
    //跨域起点------城市切换
    $.each($("#posCityBox a"), function (k,v) {
        $(v).click(function () {
            $("#cityAddress1 span").text($(this).text());
            $("#posCityBox").hide();
            autoOptions = {
                city: $(this).text(), 		 // 城市，默认全国
                input: "addressText3"						// 使用联想输入的input的id
            };
            cityChoice(autoOptions);
        });
    });
    //跨域终点------城市切换
    $.each($("#posCityBox a"), function (k,v) {
        $(v).click(function () {
            $("#cityAddress2 span").text($(this).text());
            $("#posCityBox").hide();
            autoOptions = {
                city: $(this).text(), 		 // 城市，默认全国
                input: "addressText4"						// 使用联想输入的input的id
            };
            cityChoice(autoOptions);
        });
    });
    var beginPlace, beginDetail, endPlace, endDetail, lonlatBegin, lonlatEnd;
    var map = new AMap.Map("mapContainer", {
        resizeEnable: true,
        center: [114.689762, 33.641854],		// 地图中心点
        zoom: 13,								// 地图显示的缩放级别
        keyboardEnable: false
    });
    function cityChoice(autoOptions){
        AMap.plugin(['AMap.Autocomplete','AMap.PlaceSearch'],function() {
            var placeSearch = new AMap.PlaceSearch({
                city: '周口',
                map: map
            })
            // 起点------本市
            if(autoOptions == undefined){
                autoOptions = {
                    city: $('.location_bs').text(),  								// 城市，默认全国
                    input: "addressText1"						// 使用联想输入的input的id
                };
            }
            //选择本市后，本市的终点选择城市和起点城市一致
            if(autoOptions.input=="addressText2"){
                autoOptions.city=$('.location_bs').text();
                autoOptions = {
                    city: $('.location_bs').text(),		                 // 城市，默认全国
                    input: "addressText2"						// 使用联想输入的input的id
                };
                cityChoice(autoOptions);
            }
            autocomplete = new AMap.Autocomplete(autoOptions);
            //选择地址监听
            AMap.event.addListener(autocomplete, "select", function (e) {
                // TODO 针对选中的poi实现自己的功能
                placeSearch.setCity(e.poi.adcode);
                placeSearch.search(e.poi.name);
                $("#posCityBox").hide();
                //本市起点
                if(autoOptions.input=="addressText1"){
                    $("#addressStart").text(e.poi.name);
                    $("#addressStart").attr("vname", e.poi.name);
                    $("#addressStart").attr("vlng", e.poi.location.lng);//经度
                    $("#addressStart").attr("vlat", e.poi.location.lat);//纬度
                    $('#endplace').text(autoOptions.city);
                    $.closePopup("#addressStartAll");
                }
                //本市终点
                else if(autoOptions.input=="addressText2"){
                    $.closePopup("#addressStartAll2");
                    $("#addressEnd").text(e.poi.name);
                    $("#addressEnd").attr("vname", e.poi.name);
                    $("#addressEnd").attr("vlng", e.poi.location.lng);//经度
                    $("#addressEnd").attr("vlat", e.poi.location.lat);//纬度
                    //本市起点数据
                    beginPlace = autoOptions.city,
                        beginDetail = $("#addressStart").attr("vname"),
                        lonlatBegin = {
                            lng: $("#addressStart").attr("vlng"),
                            lat: $("#addressStart").attr("vlat")
                        },
                        //本市终点数据
                        endPlace = autoOptions.city,
                        endDetail = $("#addressEnd").attr("vname"),
                        lonlatEnd = {
                            lng: $("#addressEnd").attr("vlng"),
                            lat: $("#addressEnd").attr("vlat")
                        };
                    var dataStore = {
                        type: "1",// 1乘客 2载客
                        region: $('#region').val(),// 0本市 1跨市
                        begin_place: beginPlace,// 起点位置
                        begin_detail: beginDetail,// 起点位置详细地址
                        end_place: endPlace,// 终点位置
                        end_detail: endDetail,// 终点位置详细地址
                        lonlat_begin: lonlatBegin,// 起点经纬度
                        lonlat_end: lonlatEnd,// 终点经纬度
                    }
                    //跳转到发布界面
                    location.href='{:url("index/sunfc.driver/add_publish")}?region='+ dataStore.region
                        +'&&begin_place='+dataStore.begin_place+'&&begin_detail='+dataStore.begin_detail
                        +'&&end_place='+dataStore.end_place+'&&end_detail='+dataStore.end_detail
                        +'&&lonlat_begin='+dataStore.lonlat_begin.lng+','+dataStore.lonlat_begin.lat
                        +'&&lonlat_end='+dataStore.lonlat_end.lng+','+dataStore.lonlat_end.lat;
                }
                //跨城起点
                else if(autoOptions.input=="addressText3"){
                    $("#addressStartKua").text(e.poi.name);
                    $("#addressStartKua").attr("pla", $('#addressStartAll3 span').text());
                    $("#addressStartKua").attr("vname", e.poi.name);
                    $("#addressStartKua").attr("vlng", e.poi.location.lng);//经度
                    $("#addressStartKua").attr("vlat", e.poi.location.lat);//纬度
                    $.closePopup("#addressStartAll3");
                }
                //跨城终点
                else{
                    $.closePopup("#addressStartAll4");
                    $("#addressEndKua").text(e.poi.name);
                    $("#addressEndKua").attr("vname", e.poi.name);
                    $("#addressEndKua").attr("vlng", e.poi.location.lng);//经度
                    $("#addressEndKua").attr("vlat", e.poi.location.lat);//纬度
                    //跨市起点数据
                    beginPlace = $("#addressStartKua").attr("pla"),
                        beginDetail = $("#addressStartKua").attr("vname"),
                        lonlatBegin = {
                            lng: $("#addressStartKua").attr("vlng"),
                            lat: $("#addressStartKua").attr("vlat")
                        },
                        lonlatEnd = {
                            lng: e.poi.location.lng,
                            lat: e.poi.location.lat
                        };
                    var dataStore = {
                        type: "1",// 1乘客 2载客
                        region: $('#region').val(),// 0本市 1跨市
                        begin_place: beginPlace,// 起点位置
                        begin_detail: beginDetail,// 起点位置详细地址
                        end_place: autoOptions.city,// 终点位置
                        end_detail:  e.poi.name,// 终点位置详细地址
                        lonlat_begin: lonlatBegin,// 起点经纬度
                        lonlat_end: lonlatEnd,// 终点经纬度
                    }
                    location.href='{:url("index/sunfc.driver/add_publish")}?region='+ dataStore.region
                        +'&&begin_place='+dataStore.begin_place+'&&begin_detail='+dataStore.begin_detail
                        +'&&end_place='+dataStore.end_place+'&&end_detail='+dataStore.end_detail
                        +'&&lonlat_begin='+dataStore.lonlat_begin.lng+','+dataStore.lonlat_begin.lat
                        +'&&lonlat_end='+dataStore.lonlat_end.lng+','+dataStore.lonlat_end.lat;
                }
            });
        });
    }
</script>
<script type="text/javascript" src="https://webapi.amap.com/demos/js/liteToolbar.js"></script>

<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>
    //
    wx.config({
        debug: false,
        appId: '{$jsconfig.appId}',
        timestamp: '{$jsconfig.timestamp}',
        nonceStr: '{$jsconfig.noncestr}',
        signature: '{$jsconfig.signature}',
        jsApiList: [
            'checkJsApi',
            'onMenuShareTimeline',
            'onMenuShareAppMessage',
            'onMenuShareQQ',
            'onMenuShareWeibo',
            'hideMenuItems',
            'showMenuItems',
            'hideAllNonBaseMenuItem',
            'showAllNonBaseMenuItem',
            'translateVoice',
            'startRecord',
            'stopRecord',
            'onRecordEnd',
            'playVoice',
            'pauseVoice',
            'stopVoice',
            'uploadVoice',
            'downloadVoice',
            'chooseImage',
            'previewImage',
            'uploadImage',
            'downloadImage',
            'getNetworkType',
            'openLocation',
            'getLocation',
            'hideOptionMenu',
            'showOptionMenu',
            'closeWindow',
            'scanQRCode',
            'chooseWXPay',
            'openProductSpecificView',
            'addCard',
            'chooseCard',
            'openCard'
        ]
    });
    wx.isInit = false;

    wx.ready(function () {

        //分享给朋友
        wx.onMenuShareAppMessage({
            title: "您的好友邀请您加入志愿顺风车", // 分享标题 此处$title可在控制器端传递也可在页面传递 页面传递讲解在下面哦
            desc: "爱心接力你我他，无私奉献千万家。志愿顺风车邀您同行！", //分享描述
            link: "http://didi.aliycl.com/index/sunfc.driver/index", // 分享链接
            imgUrl: "http://didi.aliycl.com/sunfc/images/logo.png", // 分享图标
            type: '', // 分享类型,music、video或link，不填默认为link
            dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
            success: function () {
                alert('分享成功');
            },
            cancel: function () {
                // 用户取消分享后执行的回调函数
                alert('取消分享');
            }
        });
        //分享到朋友圈
        wx.onMenuShareTimeline({
            title: "您的好友邀请您加入志愿顺风车", // 分享标题
            desc: "爱心接力你我他，无私奉献千万家。志愿顺风车邀您同行！", // 分享描述
            link: "http://didi.aliycl.com/index/sunfc.driver/index", // 分享链接
            imgUrl: "http://didi.aliycl.com/sunfc/images/logo.png", // 分享图标
            success: function () {
                // 用户确认分享后执行的回调函数
                alert('分享成功');
            },
            cancel: function () {
                // 用户取消分享后执行的回调函数
                alert('取消分享');
            }
        });

        // 获取位置
        wx.getLocation({
            type: 'wgs84', // 默认为wgs84的gps坐标，如果要返回直接给openLocation用的火星坐标，可传入'gcj02'
            success: function (res) {
                var latitude = res.latitude; // 纬度，浮点数，范围为90 ~ -90
                var longitude = res.longitude ; // 经度，浮点数，范围为180 ~ -180。
                var speed = res.speed; // 速度，以米/每秒计
                var accuracy = res.accuracy; // 位置精度

                var point = new BMap.Point(longitude,latitude);

                var geoc = new BMap.Geocoder();
                geoc.getLocation(point, function(rs){
                    var addComp = rs.addressComponents;
                    // alert('您所在城市：'+addComp.city);
                    $("#cityAddress span").text(addComp.city);
                    //$("#cityAddress_go span").text(addComp.city);
                    $("#cityAddress1 span").text(addComp.city);
                    autoOptions.city=addComp.city;
                });
            }

        });
    });

    wx.error(function (res) {
        alert(res.errMsg);
    });


</script>
</body>
</html>

